<!DOCTYPE html>
<html lang="en">
  <head>
    <title></title>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
  </head>
  <body>
    <form method="POST" enctype="multipart/form-data" id="form">
       <p>Your Files: <input type="file" multiple name="image" id="file" /></p>
       <p>Your Names: <input type="text" name="name" id="name"></p>
      <p>
    </form>
    <button id="submit">提交</button></p>
    <script src="/q.js"></script>
    <script>
      q.post('/postData', {
       xo: 1
      }).then(function(response){
        console.log(response.statusText);
        console.log(response.status);
        console.log(response.data);
      });
      var form = document.getElementById('form');
      var submit = document.getElementById('submit');
      submit.addEventListener('click', function(){
        var formData = new FormData(form);
        q.post('/upload', formData, {
          onProgress: function(evt) {
            console.log((evt.loaded/evt.total)*100 + '%');
          }
        })
        .then(function(response){
          console.log(response.data);
        });
      });
     
    </script>
  </body>
</html>